/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.taobao.ibatiside.model.configv3.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.taobao.ibatiside.model.configv3.Configv3Package;
import org.taobao.ibatiside.model.configv3.MapperType;
import org.taobao.ibatiside.model.configv3.MappersType;
import org.taobao.ibatiside.model.configv3.PackageType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Mappers Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.taobao.ibatiside.model.configv3.impl.MappersTypeImpl#getMapper <em>Mapper</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv3.impl.MappersTypeImpl#getPackage <em>Package</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class MappersTypeImpl extends EObjectImpl implements MappersType {
	/**
	 * The cached value of the '{@link #getMapper() <em>Mapper</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMapper()
	 * @generated
	 * @ordered
	 */
	protected EList<MapperType> mapper;

	/**
	 * The cached value of the '{@link #getPackage() <em>Package</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPackage()
	 * @generated
	 * @ordered
	 */
	protected EList<PackageType> package_;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected MappersTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Configv3Package.Literals.MAPPERS_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<MapperType> getMapper() {
		if (mapper == null) {
			mapper = new EObjectContainmentEList<MapperType>(MapperType.class, this, Configv3Package.MAPPERS_TYPE__MAPPER);
		}
		return mapper;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PackageType> getPackage() {
		if (package_ == null) {
			package_ = new EObjectContainmentEList<PackageType>(PackageType.class, this, Configv3Package.MAPPERS_TYPE__PACKAGE);
		}
		return package_;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Configv3Package.MAPPERS_TYPE__MAPPER:
				return ((InternalEList<?>)getMapper()).basicRemove(otherEnd, msgs);
			case Configv3Package.MAPPERS_TYPE__PACKAGE:
				return ((InternalEList<?>)getPackage()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Configv3Package.MAPPERS_TYPE__MAPPER:
				return getMapper();
			case Configv3Package.MAPPERS_TYPE__PACKAGE:
				return getPackage();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Configv3Package.MAPPERS_TYPE__MAPPER:
				getMapper().clear();
				getMapper().addAll((Collection<? extends MapperType>)newValue);
				return;
			case Configv3Package.MAPPERS_TYPE__PACKAGE:
				getPackage().clear();
				getPackage().addAll((Collection<? extends PackageType>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Configv3Package.MAPPERS_TYPE__MAPPER:
				getMapper().clear();
				return;
			case Configv3Package.MAPPERS_TYPE__PACKAGE:
				getPackage().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Configv3Package.MAPPERS_TYPE__MAPPER:
				return mapper != null && !mapper.isEmpty();
			case Configv3Package.MAPPERS_TYPE__PACKAGE:
				return package_ != null && !package_.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //MappersTypeImpl
